﻿namespace HiMap.CoordinateSystem
{
    using HiMap.Base;
    using System;
    using System.Text;

    public class TransCoordClass : HiMapPtrClass
    {
        internal TransCoordClass(int InPtr, bool Used)
        {
            base.m_InPtr = InPtr;
            base.m_Used = false;
        }

        public static TransCoordClass Create(string FileName)
        {
            int inPtr = VC.KWG_TRANSCOORD_CREATE(new StringBuilder(FileName));
            if (inPtr != 0)
            {
                return new TransCoordClass(inPtr, false);
            }
            return null;
        }

        ~TransCoordClass()
        {
            if (!base.m_Used)
            {
                VC.KWG_TRANSCOORD_DELETE(base.m_InPtr);
            }
        }

        public bool Trans(double x, double y, ref double x1, ref double y1)
        {
            return VC.KWG_TRANS_POINT(base.m_InPtr, x, y, ref x1, ref y1);
        }
    }
}

